import { List, WhiteSpace } from 'antd-mobile';
import { Component } from 'react'
import Link from 'umi/link';
import { connect } from 'dva'
import { mobileFilter } from '@/utils'
const { Item } = List
@connect(({ manager, loading }) => {
  return {
    manager,
  }
})
class Center extends Component {
  constructor(props) {
    super(props)
  }
  componentDidMount() {
    this.getWorkerInfo()
  }
  getWorkerInfo() {
    const { dispatch, location: {query} } = this.props
    dispatch({
      type: 'manager/getWorkerInfo',
      payload: {
        id: query.id
      }
    })
  }
  render() {
    const { manager: {workerInfo={}} } = this.props
    return (
      <div>
        <List>
        <Link to={`/manager/user/workerUpdate?id=${this.props.location.query.id}`}><Item extra={workerInfo.name} arrow="horizontal">姓名</Item></Link>
          <Item extra={mobileFilter(workerInfo.phone)}>手机</Item>
          {/* <Item extra={WOOKER_STATE_DICT[workerInfo.state]}>在职状态</Item> */}
          <Item extra={
          <span>
            {workerInfo.wages}
          <span className="unit-custom">元</span>
          </span>
        }>工资(天)</Item>
        </List>
        <WhiteSpace />
        <List>
          <Item extra={<span>{workerInfo.totalWages}
          <span className="unit-custom">元</span></span>}>应发工资</Item>
          <Link to={`/manager/createPay?id=${this.props.location.query.id}`}>
            <Item extra={<span>{workerInfo.paidWages}
            <span className="unit-custom">元</span></span>} arrow="horizontal">支付工资</Item>
          </Link>
        </List>
        <WhiteSpace />
        <List>
          <Link to={`/worker/record?id=${this.props.location.query.id}`}>
            <Item arrow="horizontal">工时明细</Item>
          </Link>
          <Link to={`/worker/payList?id=${this.props.location.query.id}`}>
            <Item arrow="horizontal">支付明细</Item>
          </Link>
          <Link to={`/worker/dayStatistics?id=${this.props.location.query.id}`}>
            <Item arrow="horizontal">日统计明细</Item>
          </Link>
          <Link to={`/worker/monthStatistics?id=${this.props.location.query.id}`}>
            <Item arrow="horizontal">月统计明细</Item>
          </Link>
        </List>
      </div>
    )
  }
}
export default Center